package GDoc::Job::Fetch::US::Legi::GPO::Senate::Hearings;

use Moose;
use WWW::Mechanize;
use XML::LibXML;

use GDoc::Job;

extends 'GDoc::Job::Fetch::US::Legi::GPO::Senate';

has '_basekey' => ( is       => 'ro',
                    init_arg => undef,
                    default  => 'us/legi/senate/%s/hearings/%s'
                  );

has '_basemeta'=> ( is       => 'ro',
                    init_arg => undef,
                    default  => 'us/legi/senate/%s/hearings/meta/%s'
                  );

sub _ident { 
    my $self = shift;
    my $meta = shift;
    my $data = shift;

    # MODS data for hearings does not have a citation number so we have
    # to get it from the URL
    my $cong = $data->{congress};
    $data->{link} =~ m{CHRG-${cong}shrg(?<num>\d{1,4})};
    my $ident    = sprintf( 'SHRG-%03d-%04d', $cong, $+{num} ); 

    return $ident;
}


1;
